#include "pwm.h"
#include "timer.h"

void PWM_init(){
   TA1CCR0 = MaxCount;
   TA1CCR1 = MaxCount/2;
}

void HzAdd(){
  T_HZ -=100;
  V_COUNTER = (int)(T_HZ*0.1);
  if(T_HZ < MinCount) T_HZ = MaxCount;
  TA1CCR0 = T_HZ;
}

void DutyAdd(){
   V_COUNTER = V_COUNTER + (int)(T_HZ*0.1);
   if(V_COUNTER > (int)(0.9*T_HZ))  V_COUNTER = (int)(T_HZ*0.1);
   TA1CCR1 = V_COUNTER;
}

